package com.baosight.sczx.common.zm.cInterface.ct;

import java.util.HashMap;
import java.util.List;

import com.baosight.iplat4j.core.spring.SpringApplicationContext;
import com.baosight.iplat4j.dao.Dao;
import com.baosight.sczx.common.zm.cInterface.CmesConstants;
import com.baosight.sczx.zm.ct.domain.ZMCTSystem;


/**
 * 短信平台-系统设置
 * <p>Title: System.java</p>
 * <p>Description: </p>
 * <p>Copyright: Baosight Software LTD.co Copyright (c) 2002</p>
 * <p>Company: Baosight Software</p>
 * @author 高强
 * @version 1.0
 * <pre>Histroy:
 *          2012-06-14 上午10:46:38  高强  Create
 *</pre>
 */
public class SystemSet {
	
	private static Dao dao = (Dao)SpringApplicationContext.getBean("dao");
	private static SystemSet instance = new SystemSet();
	private static ZMCTSystem system;
	
	private SystemSet(){
		initData();//当第一次使用的时候初始化
	}
	
	@SuppressWarnings("unchecked")
	private void initData(){
		List<ZMCTSystem> _list = dao.query("ZMCTSystem.query", new HashMap<String, String>());
		if(_list.size() < 1) {
			system = null;
		}
		else {
			system = _list.get(0);
		}
		CmesConstants.SYSTEMSETTING_SMS = 0;
	}
	
	/**
	 * 获得是否启动服务
	 * <p>Function: getFdStart</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2012-06-14 上午10:46:38  高强 
	 * </p>
	 *
	 */
	public String getFdStart(){
		String _temp = new String("是");//默认为“是”，启动
		if(system != null) {
			_temp = system.getFdStart();
		}
		
		return _temp;
	}
	
	/**
	 * 获得短信设备类型; 
	 * <p>Function: getFdSmsDevice</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *   2012-06-14 上午10:46:38  高强 
	 * </p>
	 *
	 */
	public String getFdSmsDevice(){
		String _temp = new String("0");//默认为0，短信猫
		if(system != null) {
			_temp = system.getFdSmsDevice();
		}
		
		return _temp;
	}
	
	/**
	 * 获得短信服务周期
	 * <p>Function: getFdSystemFrequency</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *   2012-06-14 上午10:46:38  高强 
	 * </p>
	 *
	 */
	public String getFdSystemFrequency(){
		String _temp = new String("0");//默认为0
		if(system != null) {
			_temp = system.getFdSystemFrequency();
		}
		
		return _temp;
	}
	
	/**
	 * 获得人员信息数据源
	 * <p>Function: getFdPersonDs</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *   2012-06-14 上午10:46:38  高强 
	 * </p>
	 *
	 */
	public String getFdPersonDs(){
		String _temp = new String("0");//默认为0
		if(system != null) {
			_temp = system.getFdPersonDs();
		}
		
		return _temp;
	}
	
	/**
	 * 获得部门信息数据源
	 * <p>Function: getFdDepartmentDs</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *   2012-06-14 上午10:46:38  高强 
	 * </p>
	 *
	 */
	public String getFdDepartmentDs(){
		String _temp = new String("0");//默认为0
		if(system != null) {
			_temp = system.getFdDepartmentDs();
		}
		
		return _temp;
	}
	
	/**
	 * 获得人员信息sql
	 * <p>Function: getFdPersonSql</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *   2012-06-14 上午10:46:38  高强 
	 * </p>
	 *
	 */
	public String getFdPersonSql(){
		String _temp = new String("0");//默认为0
		if(system != null) {
			_temp = system.getFdPersonSql();
		}
		
		return _temp;
	}
	
	/**
	 * 获得部门信息sql
	 * <p>Function: getFdDepartmentSql</p>
	 * <p>Description: </p>
	 * <p>return value:String</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *   2012-06-14 上午10:46:38  高强 
	 * </p>
	 *
	 */
	public String getFdDepartmentSql(){
		String _temp = new String("0");//默认为0
		if(system != null) {
			_temp = system.getFdDepartmentSql();
		}
		
		return _temp;
	}
	
	/**
	 * 得到对象的唯一句柄
	 * <p>Function: getInstance</p>
	 * <p>Description: </p>
	 * <p>return value:SystemSettingCD</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-1-18下午07:50:20 严洪浩
	 * </p>
	 *
	 */
	public static SystemSet getInstance(){
		if(CmesConstants.SYSTEMSETTING_SMS == 1) {
			instance = new SystemSet();
		}
		
		return instance;
	}
}
